<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const a = {
      count: 1,
      toString() {
        return this.count++;
      },
    };

    console.log(a == 1 && a == 2 && a == 3); // true
    var c = 1
    Object.defineProperty(window, 'b', {
      get() {
        return c++
      }
    })

    console.log(b === 1 && b === 2 && b === 3); // true
  </script>
</body>

</html>